package c.x.jy.dao.dao;

import c.x.jy.dao.entity.SysRoleEntity;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

/**
 * 角色
 * 
 * @author amwhyh
 * @email xxx@xx.com
 * @date 2021-05-20 20:25:55
 */
@Mapper
public interface SysRoleDao extends BaseMapper<SysRoleEntity> {
    @Select("SELECT DISTINCT  sr.* FROM `sys_role` sr LEFT JOIN sys_user_role sru on sru.role_id=sr.role_id    ${ew.customSqlSegment}")
     List<SysRoleEntity> selectRolesByUserId(@Param(Constants.WRAPPER)QueryWrapper<SysRoleEntity> query);

    @Select("SELECT DISTINCT   sr.role_name FROM `sys_role` sr LEFT JOIN sys_user_role sru on sru.role_id=sr.role_id    ${ew.customSqlSegment}")
    Set<String> selectSetListRolesByUserId(@Param(Constants.WRAPPER)QueryWrapper<SysRoleEntity> query);

}

